package com.example.baselib.widget;

import com.example.baselib.imageLoader.ImageLoader;
import ohos.agp.components.AttrSet;
import ohos.agp.components.Image;
import ohos.app.Context;

/**
 * Description:  TODO
 * Author: admin
 * CreateDate: 2021/4/8 17:18
 */
public class BGGImage extends Image {

    private Object objKey;

    public BGGImage(Context context) {
        super(context);
    }

    public BGGImage(Context context, AttrSet attrSet) {
        super(context, attrSet);
    }

    public BGGImage(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }


    public void load(Object obj) {
        load(obj, -1);
    }

    public void load(Object obj, int resId) {
        this.objKey = obj;
        ImageLoader.getInstance().loadResource(obj, this, resId, null);
    }

    public void cancel() {
        ImageLoader.getInstance().cancelLoad(objKey);
    }


}
